package cn.ycc1.boot3csv.controller;

import cn.ycc1.boot3csv.entity.Order;
import cn.ycc1.boot3csv.service.TestService;
import lombok.RequiredArgsConstructor;
import org.springframework.core.io.ClassPathResource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.InputStream;
import java.util.List;

/**
 * @author ycc
 * @date 2025/11/13
 */
@RequiredArgsConstructor
@RequestMapping("/test")
@RestController
public class TestController {
    private final TestService testService;

    @GetMapping("hello")
    public String hello() {
        return "hello csv";
    }

    @GetMapping("test1")
    public String test1() {
        List<String[]> list = testService.readSimpleCSV();
        System.out.println(list);
        return "test1";
    }

    @GetMapping("test2")
    public String test2() {
        List<Order> list = testService.readComplexCSV();
        System.out.println(list);
        return "test2";
    }

    @GetMapping("test3")
    public String test3() {
        testService.readComplexCSVSimple();
        return "test3";
    }

}
